/**
 * 
 */
package com.ms.game.itembox.db;

import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Table;

import org.hibernate.annotations.Type;

import com.ms.game.itembox.ItemChangeWay;
import com.ms.game.itembox.ItemStatus;
import com.ms.game.itembox.container.ItemBoxBin;
import com.ms.game.itembox.container.ItemExtraSettings;
import com.ms.game.sendgift.db.SendGiftNotifyModel;
import com.xpec.c4.db.model.basic.BasicGameModel;
import com.xpec.c4.game.utility.GUID;

/**
 * 角色的道具資料
 * 
 * @author TW15010
 */
@Entity
@org.hibernate.annotations.Entity(dynamicInsert = true, dynamicUpdate = true)
@Table(name = "player_item")
@org.hibernate.annotations.Table(
		appliesTo = "player_item", indexes = {
				@org.hibernate.annotations.Index(name = "IDX_OWNERID", columnNames = { "ownerId" }),
				@org.hibernate.annotations.Index(name = "IDX_SENDGIFTORDERID", columnNames = { "sendGiftOrderId" }),
				@org.hibernate.annotations.Index(name = "IDX_STATUS", columnNames = { "status" }),
				@org.hibernate.annotations.Index(name = "IDX_SN", columnNames = { "sn" }),
		})
public class PlayerItemModel extends BasicGameModel {
	private static final long serialVersionUID = 1583435913960084015L;
	
	/**
	 * 道具序號
	 */
	private String sn;

	/**
	 * 擁有的角色 guid {@link GUID}
	 */
	private String ownerId;

	/**
	 * 數據表 {@link ItemBoxBin} 中對應的 key
	 */
	private String itemId;

	/** 預設道具ID**/
	private String basicItemId;

	/**
	 * 精煉期結束時間
	 */
	private long refineEndTime;

	/**
	 * 精煉階數
	 */
	private int refineLevel;

	/**
	 * 堆疊數量
	 */
	private int count;

	/**
	 * 寄送禮物的訂單 id {@link SendGiftNotifyModel#getOrderID()}
	 */
	private String sendGiftOrderId;

	/**
	 * 狀態 {@link ItemStatus}
	 */
	private int status;
	
	/** 過期時間 (秒)*/
	private long expireTime;
	
	/** 道具的額外設定*/
	private ItemExtraSettings extraSettings;
	
	/** 建立此物品的方式 */
	private ItemChangeWay createItemWay;
	
	/** 建立此model的來源遊戲類型 */
	private String createGameType;
	
	/** 建立此model的來源遊戲館別 */
	private String createHallType;
	
	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(sn + "|" + itemId + "|" + count);
		return sb.toString();
	}

	public String getOwnerId() {
		return ownerId;
	}

	public void setOwnerId(String ownerId) {
		this.ownerId = ownerId;
	}

	public long getRefineEndTime() {
		return refineEndTime;
	}

	public void setRefineEndTime(long refineEndTime) {
		this.refineEndTime = refineEndTime;
	}

	public int getRefineLevel() {
		return refineLevel;
	}

	public void setRefineLevel(int refineLevel) {
		this.refineLevel = refineLevel;
	}

	public int getCount() {
		return count;
	}

	public void setCount(int count) {
		this.count = count;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getItemId() {
		return itemId;
	}

	public void setItemId(String itemId) {
		this.itemId = itemId;
	}

	public String getSendGiftOrderId() {
		return sendGiftOrderId;
	}

	public void setSendGiftOrderId(String sendGiftOrderId) {
		this.sendGiftOrderId = sendGiftOrderId;
	}

	public String getSn() {
		return sn;
	}

	public void setSn(String sn) {
		this.sn = sn;
	}
	
	public String getBasicItemId() {
		return basicItemId;
	}

	public void setBasicItemId(String basicItemId) {
		this.basicItemId = basicItemId;
	}

	public long getExpireTime() {
		return expireTime;
	}

	public void setExpireTime(long expireTime) {
		this.expireTime = expireTime;
	}

	@Type(type = "com.xpec.c4.db.usertype.item.ItemExtraSettingUserType")
	public ItemExtraSettings getExtraSettings() {
		return extraSettings;
	}

	public void setExtraSettings(ItemExtraSettings extraSettings) {
		this.extraSettings = extraSettings;
	}

	@Enumerated(EnumType.STRING)
	public ItemChangeWay getCreateItemWay() {
		return createItemWay;
	}

	public void setCreateItemWay(ItemChangeWay createItemWay) {
		this.createItemWay = createItemWay;
	}

	public String getCreateGameType() {
		return createGameType;
	}

	public void setCreateGameType(String createGameType) {
		this.createGameType = createGameType;
	}

	public String getCreateHallType() {
		return createHallType;
	}

	public void setCreateHallType(String createHallType) {
		this.createHallType = createHallType;
	}
	
}
